package xuanke;

import java.util.LinkedList;
import java.util.List;

class Classlist {
	List zclasss = new LinkedList<>();
	List tclasss = new LinkedList<>();
	List kclasss = new LinkedList<>();
	public void kaike(int a1,int a2,int a3) {
		
		System.out.println("教师信息");
		
		Teacher t1 = new Teacher("1","教师1","男","课程1",a1);
		t1.printmessage();
		Teacher t2 = new Teacher("2","教师2","男","课程2",a2);
		t2.printmessage();
		Teacher t3 = new Teacher("3","教师3","男","课程3",a3);
		t3.printmessage();
		
		System.out.println("课程信息");
		
		Course c1 = new Course(t1.num,t1.classs,"教学楼","10:00",t1.name);
		c1.cunCourse();
		Course c2 = new Course(t2.num,t2.classs,"教学楼","8:00",t2.name);
		c2.cunCourse();
		Course c3 = new Course(t3.num,t3.classs,"教学楼","13:30",t3.name);
		c3.cunCourse();

		zclasss.add(c1.numbers);
		zclasss.add(c2.numbers);
		zclasss.add(c3.numbers);
		tclasss.add(t1.numbers);
		tclasss.add(t2.numbers);
		tclasss.add(t3.numbers);
		for(int i=0;i<zclasss.size();i++) {
			List a = (List)tclasss.get(i);
			int sum = (int)a.get(a.size()-1);
			if(sum == 1) {
				kclasss.add(zclasss.get(i));
				System.out.println(zclasss.get(i));
			}
			else {
				System.out.println("教师"+a.get(0)+"未开课");
			}
		}
	}
	
}

public class Xuanze {
	List bclasss = new LinkedList<>();
	Classlist ss = new Classlist();
	Student s1;
	Xuanze(Student s1){
		this.s1=s1;
	}
	public void kaike(int a1,int a2,int a3) {
		ss.kaike(a1,a2,a3);
	}
	
	public void xuanzeke(String choice) {
		s1.choice = choice;
		for(int i=0;i<ss.kclasss.size();i++) {
			List a = (List)ss.kclasss.get(i);
			if (s1.choice == a.get(0)) {
				System.out.println("选课"+a.get(1)+"成功");
				bclasss.add(a);
				break;
			}
		}
	
		System.out.println("此时课程为");
		s1.show2(bclasss);
	}

	public void shanchuke(String choice2) {
		s1.choice2 = choice2;
		for(int i=0;i<bclasss.size();i++) {
			List a = (List)bclasss.get(i);
			if (s1.choice2.equals(a.get(0))) {
				System.out.println("退课"+a.get(1)+"成功");
				bclasss.remove(a);
				break;
			}
		}
		System.out.println("此时课程为");
		s1.show2(bclasss);
	}
}